<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        input {
            float: left;
            width: 200px;
            height: 35px;
            outline: none;
        }

        button {
            float: left;
            width: 70px;
            height: 40px;
            margin-left: -1px;
            outline: none;
        }
    </style>
</head>

<body>
    <input type="text" value="0">
    <button>检测</button>
    <script>
        let input = document.querySelector('input')
        let button = document.querySelector('button')
        button.onclick = function () {
            let val = input.value
            if (!isNaN(val)) {
                if (val > 0) {
                    alert('正数')
                } else if (val < 0) {
                    alert("负数")
                } else {
                    alert('您输入的是零')
                }
            } else {
                alert('您输入的不是数字')
            }
        }
    </script>
</body>

</html>